﻿using DataWasher.WebApi.Interfaces;
using DataWasher.WebApi.IServices;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataWasher.WebApi.Controllers
{
    [Route("api/extract")]
    [ApiController]
    public class ExtractController : ControllerBase
    {
        public readonly IDataExtractService _service;
        private readonly IExtrackDataFromSqlServer _csService;
        public ExtractController(IDataExtractService service, IExtrackDataFromSqlServer csService)
        {
            _service = service;
            _csService = csService;
        }
        [HttpGet]
        [Route("excute")]
        public async Task<bool> Extract()
        {
            return await _service.Extract();
        }

        [HttpGet]
        [Route("excute/tomysql")]
        public async Task<bool> ExtractCrossDB()
        {
            return await _csService.InsertToMysql();
        }

        [HttpGet]
        [Route("filter/data")]
        public async Task<bool> ExtractFromSqlServerToStorage()
        {
            return await _service.ExtractFilterData();
        }

        [HttpGet]
        [Route("execute/problem")]
        public async Task<bool> GetProblemData()
        {
            return await _service.ExtracProblemData();
        }


    }
}
